<?php
/*
	插件页面事件增删查改
*/
defined('BY_JYA') or exit('error');
global $_RQ,$_AR;
$_RQ['op']=$_RQ['op']?$_RQ['op']:'list';
$return=array();
if($_RQ['page_id']){
	$_SESSION['page_id']=intval($_RQ['page_id']);
}
if(!$_SESSION['page_id']){
	exi('请先选择页面！','error');
}
$params=array(
	'page_id'=>$_SESSION['page_id'],
	'plugin_id'=>$_SESSION['plugin_id']
);
if($_RQ['op']=='list'){
	$result=cloud_request('plugin.page_event.list',$params);
	exi($result);
}
if($_RQ['op']=='edit'){
	$id=intval($_RQ['id']);
	if($id){
		$params['id']=$id;
	}
	$result=cloud_request('plugin.page_event.edit',$params);
	exi($result);
}
if($_RQ['op']=='post'){
	$post=get_postdata();
	$params['postdata']=base64_encode(json_encode($post));
	$result=cloud_request('plugin.page_event.post',$params);
	exi($result);
}
if($_RQ['op'] == 'del'){
	if($_RQ['id']){
		$params['id']=intval($_RQ['id']);
	}
	if($_RQ['del']){
		$params['del']=trim($_RQ['del']);
	}
	$result=cloud_request('plugin.page_event.del',$params);
	exi($result);
}